package com.mall.manager.service;

import java.util.List;

import org.springframework.stereotype.Service;

import com.mall.common.dao.MongoDBManager;
import com.mall.untils.DateUtils;
import com.mongodb.BasicDBList;
import com.mongodb.BasicDBObject;
import com.mongodb.DBObject;

@Service
public class SellStatisticService {

	/**
	 * 查询昨天注册的园所信息
	 * @param collection 表
	 * @return
	 */
	public List<DBObject> findMongodb(String collection){
		//当前日期的前一天
		String beforDate = DateUtils.getNowBeforDay();	
		Long begin = DateUtils.getTimestampOfSS(beforDate+" 00:00:00");
		Long end = DateUtils.getTimestampOfSS(beforDate+" 23:59:59");
		BasicDBList list = new BasicDBList();
		//按时间检索前一天的数据
		BasicDBObject dbo = new BasicDBObject();
		list.add(new BasicDBObject("ct", new BasicDBObject("$gte", begin)));
		list.add(new BasicDBObject("ct", new BasicDBObject("$lte", end)));
		dbo.put("$and", list);
		return MongoDBManager.findForCommitTime(collection, dbo);
	}
}
